﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cheems.Interface.Configuration
{
    public interface IConfig<T> where T : new()
    {
        /// <summary>
        /// 获取配置
        /// </summary>
        /// <returns></returns>
        T GetConfig();
        /// <summary>
        /// 完整更新配置
        /// </summary>
        /// <param name="updateData"></param>
        void UpdateConfig(T updateData);
        /// <summary>
        /// 修改配置
        /// </summary>
        /// <param name="updateAction"></param>
        void UpdateConfig(Action<T> updateAction);
        /// <summary>
        /// 停止配置文件监听
        /// </summary>
        void StopWatching();
        /// <summary>
        /// 配置文件发生改变
        /// </summary>
        event Action<T> OnConfigChanged;
    }
}
